package com.yx.yinshanjinniu.activitys;

import android.os.Bundle;
import android.webkit.WebView;
import android.widget.TextView;

import com.yx.yinshanjinniu.R;
import com.yx.yinshanjinniu.base.BaseActivity;
import com.yx.yinshanjinniu.utils.StringUtil;


public class HotNewsDetailActivity extends BaseActivity {

    private TextView tv_titles;
    private WebView wv_content;
    private String mTitle;
    private String mContent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mTitle = getIntent().getStringExtra("title");
        mContent = getIntent().getStringExtra("content");
        initData();
    }

    private void initData() {
        tv_titles.setText(StringUtil.isEmpty(mTitle) ? "最新资讯" : mTitle);
//        wv_content.loadDataWithBaseURL(null, StringUtil.isEmpty(mContent) ? "最新资讯敬请期待" : mContent, "text/html", "utf-8", null);
        wv_content.loadDataWithBaseURL(
                null,
                "<style>img{max-width:100%;height:auto;}</style>" + (StringUtil.isEmpty(mContent) ? "最新资讯敬请期待" : mContent),
                "text/html",
                "utf-8",
                null
        );
//        tv_content.setText(StringUtil.isEmpty(mContent) ? "最新资讯敬请期待" : Html.fromHtml(mContent));
    }

    @Override
    protected int setContentView() {
        return R.layout.activity_hot_news_detail;
    }

    @Override
    protected void findViews() {
        tv_titles = $(R.id.tv_titles);
        wv_content = $(R.id.wv_content);
    }

    @Override
    protected void setListeners() {

    }
}